//
//  BaseMapManager.swift
//  ANOASTORE
//
//  Created by hudan on 2025/11/24.
//  Copyright © 2025 zwb. All rights reserved.
//

import Foundation

class BaseMapManager: NSObject {
    func addErrorButton(superV:UIView, _ offSet: CGFloat) {
        let tipBtn = UIButton()
        superV.addSubview(tipBtn)
        tipBtn.addTouchUpInSideAction { _ in
        }
        tipBtn.layer.borderWidth = 1
        tipBtn.layer.borderColor = UIColor.red.cgColor
        tipBtn.layer.cornerRadius = 10
        tipBtn.layer.masksToBounds = true
        tipBtn.setTitle("地图初始化失败\n重新登录试试", for: .normal)
        tipBtn.setTitleColor(.red, for: .normal)
        tipBtn.titleLabel?.textAlignment = .center
        tipBtn.titleLabel?.font = UIFont.boldSystemFont(ofSize: 20)
        tipBtn.titleLabel?.numberOfLines = 0
        tipBtn.snp.makeConstraints { make in
            make.centerX.equalTo(superV)
            make.centerY.equalTo(superV).offset(offSet)
            make.width.equalTo(300)
            make.height.equalTo(100)
        }
    }
    
    func addTipButton(superV: UIView, _ offSet: CGFloat) {
        let tipBtn = UIButton()
        superV.addSubview(tipBtn)
        tipBtn.addTouchUpInSideAction { _ in
            if  LocationTool.shared.getPermission() {
                KSToast("授权完成，请退回重新进入")
            } else {
                
            }
        }
        tipBtn.layer.borderWidth = 1
        tipBtn.layer.borderColor = UIColor.red.cgColor
        tipBtn.layer.cornerRadius = 10
        tipBtn.layer.masksToBounds = true
        tipBtn.setTitle("地图未授权\n请点此授权后，重新进入！", for: .normal)
        tipBtn.setTitleColor(.red, for: .normal)
        tipBtn.titleLabel?.textAlignment = .center
        tipBtn.titleLabel?.font = UIFont.boldSystemFont(ofSize: 20)
        tipBtn.titleLabel?.numberOfLines = 0
        tipBtn.snp.makeConstraints { make in
            make.centerX.equalTo(superV)
            make.centerY.equalTo(superV).offset(offSet)
            make.width.equalTo(300)
            make.height.equalTo(100)
        }
    }
}
